package store.lunangangster.bpmn.converter;

import javax.xml.stream.XMLStreamReader;
import org.apache.commons.lang3.StringUtils;

public abstract class ActivityConverter extends FlowNodeConverter {

  public ActivityConverter() {
    super();
  }

  protected static boolean parseCompensation(XMLStreamReader xsr) {
    String compensation = xsr.getAttributeValue(null, ATTRIBUTE_ACTIVITY_COMPENSATION);
    return ATTRIBUTE_VALUE_TRUE.equals(compensation);
  }

  protected static String parseDefaultSequenceFlow(XMLStreamReader xsr) {
    String defaultSequenceFlow = xsr.getAttributeValue(null, ATTRIBUTE_ACTIVITY_DEFAULT);
    return StringUtils.isNotBlank(defaultSequenceFlow) ? defaultSequenceFlow : null;
  }
}
